home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / ultqsrc.zip / FEIGN.QC < prev    next >
Text File  |  1996-09-12  |  7KB  |  164 lines

  1. // This is my poor attempt to add something useful 
  2.  
  3. // Globals
  4.  
  5. .float isfeign;
  6. .string oldweaponmodel;         // change to local?
  7. .float oldweapon;               // change to local?
  8. .float foolplay;
  9.  
  10. // Frames
  11. //
  12. //      I had to re-init them all to be able to call them.
  13. // If I had this function in player.qc, this wouldn't be
  14. // necessary, but then it would be less modular.
  15.  
  16. $cd /raid/quake/id1/models/player_4
  17. $origin 0 -6 24
  18. $base base        
  19. $skin skin
  20.  
  21. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  22. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  23. $frame stand1 stand2 stand3 stand4 stand5
  24. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  25. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  26. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  27. $frame pain1 pain2 pain3 pain4 pain5 pain6
  28. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  29. $frame axdeth7 axdeth8 axdeth9
  30. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  31. $frame deatha9 deatha10 deatha11
  32. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  33. $frame deathb9
  34. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  35. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  36. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  37. $frame deathd8 deathd9
  38. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  39. $frame deathe8 deathe9
  40. $frame nailatt1 nailatt2
  41. $frame light1 light2
  42. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  43. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  44. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  45. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  46. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  47. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  48.  
  49. // Falling down animation.  Any would have done.
  50. /*
  51. void()  player_feigna1    =       [       $deatha1,       player_feigna2    ] {};
  52. void()  player_feigna2    =       [       $deatha2,       player_feigna3    ] {};
  53. void()  player_feigna3    =       [       $deatha3,       player_feigna4    ] {};
  54. void()  player_feigna4    =       [       $deatha4,       player_feigna5    ] {};
  55. void()  player_feigna5    =       [       $deatha5,       player_feigna6    ] {};
  56. void()  player_feigna6    =       [       $deatha6,       player_feigna7    ] {};
  57. void()  player_feigna7    =       [       $deatha7,       player_feigna8    ] {};
  58. void()  player_feigna8    =       [       $deatha8,       player_feigna9    ] {};
  59. void()  player_feigna9    =       [       $deatha9,       player_feigna10   ] {};
  60. void()  player_feigna10   =       [       $deatha10,      player_feigna11   ] {};
  61. void()  player_feigna11   =       [       $deatha11,      player_feigna11   ] {};
  62. */
  63.  
  64. // Standing up animation.  This one looks the best.
  65.  
  66. void()  player_upa1    =       [       $deathd9,        player_upa2    ] {};
  67. void()  player_upa2    =       [       $deathd8,        player_upa3    ] {};
  68. void()  player_upa3    =       [       $deathd7,        player_upa4    ] {};
  69. void()  player_upa4    =       [       $deathd6,        player_upa5    ] {};
  70. void()  player_upa5    =       [       $deathd5,        player_upa6    ] {};
  71. void()  player_upa6    =       [       $deathd4,        player_upa7    ] {};
  72. void()  player_upa7    =       [       $deathd3,        player_upa8    ] {};
  73. void()  player_upa8    =       [       $deathd2,        player_upa9    ] {};
  74. void()  player_upa9    =       [       $deathd1,        player_upa9    ] {player_stand1 ();};
  75.  
  76.  
  77. //      I had to make new backpack routines so that you wouldn't give up 
  78. // your ammo, pick it up while you're throwing it, and have a neat message.
  79.  
  80. void() FakeBackpackTouch =
  81. {
  82.         if (other.classname != "player")        // Monsters won't pick up
  83.         return;
  84.         if (other.health <= 0)                  // Dead people won't pick up
  85.         return;
  86.         if ( (self.owner == other) && ( (self.nextthink - time) > 99 ) )        // The thrower won't pick up
  87.                 return;                                                         // unless 20 sec has passed.
  88.  
  89.         sprint (other, "Hmmmm, empty...\n");
  90.         sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);    // backpack touch sound
  91.         stuffcmd (other, "bf\n");       // flashes the screen
  92.     remove(self);
  93.     
  94. };
  95.  
  96.  
  97. void() FakeBackpack =
  98. {
  99.     local entity    item;
  100.  
  101.     item = spawn();
  102.         item.owner = self;
  103.         item.origin = self.origin - '0 0 24';
  104.     item.velocity_z = 300;
  105.     item.velocity_x = -100 + (random() * 200);
  106.     item.velocity_y = -100 + (random() * 200);
  107.     item.flags = FL_ITEM;
  108.     item.solid = SOLID_TRIGGER;
  109.         item.movetype = MOVETYPE_TOSS;
  110.     setmodel (item, "progs/backpack.mdl");
  111.     setsize (item, '-16 -16 0', '16 16 56');
  112.         item.touch = FakeBackpackTouch;
  113.     item.nextthink = time + 120;    // remove after 2 minutes
  114.     item.think = SUB_Remove;
  115. };
  116.  
  117. void() feign =
  118. {
  119.         if (!self.isfeign)              // If not already, feign death
  120.         {
  121.                 self.foolplay = FALSE;
  122. //                        player_feigna1 ();      // death animation
  123.                         player_diea1 ();      // death animation
  124.                         DeathSound();           // yell like you're dying
  125.                         FakeBackpack();         // throw fake backpack
  126.                 self.oldweapon = self.weapon;   
  127.                 self.weapon = 0;
  128.                 self.oldweaponmodel = self.weaponmodel;
  129.                 self.weaponmodel = "";
  130.                 setsize (self , '-16 -16 -4' , '16 16 4');      // change bounding bos so you're shorter
  131.                 self.view_ofs = '0 0 2';        // put view near ground
  132.                 self.movetype = MOVETYPE_TOSS;
  133.                 self.isfeign = TRUE;
  134.                 if (self.enemy.classname == "player")
  135.                         {
  136.                         self.enemy.frags = self.enemy.frags + 1;
  137.                         self.foolplay = TRUE;
  138.                         }
  139.                 else
  140.                         {
  141.                         self.frags = self.frags - 1;
  142.                         self.foolplay = FALSE;   
  143.                         }
  144.         }
  145.  
  146.         else                    // otherwise, get up
  147.  
  148.         {
  149.                 self.movetype = MOVETYPE_WALK;
  150.                 setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  151.                 self.view_ofs = '0 0 22';
  152.                 self.isfeign = FALSE;
  153.                 player_upa1();
  154.                 self.weaponmodel = self.oldweaponmodel;
  155.                 self.weapon = self.oldweapon;
  156.                 self.oldweapon = 0;
  157.                 if (self.foolplay)
  158.                         self.enemy.frags = self.enemy.frags - 1;
  159.                 else
  160.                         self.frags = self.frags + 1;
  161.         self.foolplay = FALSE; 
  162.         }
  163. };
  164.